<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
<script>
  // 对数组的解构
  let [a,b,c] = [2,3,4]
  // console.log(b);//a = 2, b=3, c=4
  // ...剩余运算符:只能写在最后
  let [d,...e] = [2,3,4]
  // console.log(e);//d = 2, e=[3,4]
  //嵌套 [2,[3,[4,5]]]
  let [x,[y,z]] = [2,[3,[4,5]]]
  // console.log("x:"+x);
  // console.log("y:"+y);
  // console.log("z:",z);//[4,5]
  //可忽略 [2,3,[4,5]]
  let [f,,h] = [2,3,[4,5]]
  // console.log(h);//[4,5]
  //不完全解构 []
  let [j=1,k] = [2,3]
  console.log(j);//2 j=1表示如果解构的数组是[]，没有数据，则j有默认值1；如果[]中有数据，则解构数组中的数据。
  console.log(k);//3
</script>
</body>
</html>